/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.foxline.clinicplus.service;

import br.com.foxline.clinicplus.entity.Clinic;
import java.util.HashMap;
import javax.ejb.Stateless;
import javax.persistence.Query;

/**
 *
 * @author roniere
 */
@Stateless
public class ClinicService extends GenericService<Clinic> {

    public ClinicService() {
        super(Clinic.class);
    }
    
    public HashMap<String, Object> getCabecalho(HashMap<String, Object> parametros){
        
        Query q = getEntityManager().createQuery("Select c from Clinic c").setMaxResults(1);
        
        if(parametros == null){
            parametros = new HashMap<String, Object>();
        }
        parametros.put("nomeclinica", "Clinica Dr. João Silva Filho");
        try{
            Clinic clini = (Clinic) q.getSingleResult();
            parametros.put("nomeclinica", clini.getName());
        }catch(Exception e){
            e.printStackTrace();
        }
        
        return parametros;
    }
}
